use strict;
use warnings;

soi_start( @ARGV );

sub soi_start{
	my( $target, $max ) = @_;
	my $count = 0;
	$count = soi_main( 0, 0, 0, $target, $count, $max );
	print "$count\n";
}

sub soi_main{
	my( $nest, $sum, $now, $target, $count, $max ) = @_;
	if( $nest == $max ){
		if( $sum == $target ){
			$count++;
		}
		return $count;
	}
	foreach my $SumInt ( $now..9 ){
		last if( $sum + $SumInt > $target );
		$count = soi_main( $nest+1, $sum+$SumInt, $SumInt+1, $target, $count, $max );
	}
	return $count;
}

1;
